home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 6436 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1003 b 

  1. Path: ccshst05.cs.uoguelph.ca!ccshst01!jsadler
  2. From: jsadler@uoguelph.ca (J. Sadler)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: random number in assembly
  5. Date: 27 Mar 1996 22:21:34 GMT
  6. Organization: University of Guelph
  7. Message-ID: <4jcf1e$ftt@ccshst05.cs.uoguelph.ca>
  8. References: <Pine.NEB.3.91.960327200012.12939A-100000@dirty.cute.fi>
  9. NNTP-Posting-Host: ccshst01.cs.uoguelph.ca
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. : Could someone tell me how to get a VERY WELL randomized number?
  13.  
  14. srand(time(NULL)); /* seeds random sequence by # of seconds */
  15.    
  16. will get u a very random seed point to create more random #'s from.
  17. there are many ways to create the random #:
  18.  
  19. var=((rand()%high)+low; /* is one */
  20.       
  21. i'll have to look up the 'classic' one: rand()?high+low-1
  22. there's one that works for decimal based rand sequences too.
  23. i also saw i quadratic one in some post here.
  24.  
  25.             concluding that i have a sever memory block
  26.                          at this time, i leave u in the hands of others.
  27.